Skip to content

feat(core): enrich hardcoded system prompts in container templates#190

Open
konard wants to merge 6 commits into
ProverCoderAI:mainfrom
konard:issue-189-ba783568b6b3
Open

feat(core): enrich hardcoded system prompts in container templates#190
konard wants to merge 6 commits into
ProverCoderAI:mainfrom
konard:issue-189-ba783568b6b3

Conversation

@konard
Copy link
Copy Markdown
Contributor

@konard konard commented Mar 24, 2026

Summary

Fixes #189

The system prompts injected into docker-git containers (CLAUDE.md, AGENTS.md, GEMINI.md at startup) were minimal — just agent identity and workspace context. The user requested enriching them based on all prompt-related issues.

What changed

New file: packages/lib/src/core/templates-entrypoint/system-prompt-content.ts

  • Shared behavioral instructions module — single source of truth for all agents
  • Contains enriched prompt sections extracted from issues

Modified template files (import and inject systemPromptBehavior):

  • packages/lib/src/core/templates-entrypoint/claude-extra-config.ts — Claude prompt
  • packages/lib/src/core/templates-entrypoint/codex.ts — Codex/AGENTS prompt
  • packages/lib/src/core/templates-entrypoint/gemini.ts — Gemini prompt

Modified test:

  • packages/app/tests/docker-git/entrypoint-auth.test.ts — updated assertions for new prompt structure

Docs (from previous commit):

  • CLAUDE.md and AGENTS.md — project-level instructions aligned with container prompts

New prompt sections (from issues)

Issue Requirement Added
#90 Isolated environment awareness
#41 Role definition (mathematician-programmer)
#41 Deep Research process rule
#41 Rational comments format (CHANGE/WHY/REF)
#41 Research loop on failures
#41 Instrumental behavior (execute, don't guide)
#101, #4 Mandatory subagent delegation + micro-agents
#54 Plan mode on clone
#96 Mandatory response contract (trust gap)
#96 Claim safety rule (no "fixed" without proof)
#96 Visibility rule (why user may not see result)
#96 CI/CD rule (failing step + reproduce command)
#92 Proof of execution in PRs (detailed)
#78 Public API, no localhost URLs

Architecture

The prompt has three layers:

  1. Static code (system-prompt-content.ts → templates) — behavioral instructions injected at container startup
  2. Dynamic (generated by templates-entrypoint/*.ts) — workspace context, permissions, tool access
  3. Project-level (CLAUDE.md, AGENTS.md in repo root) — coding standards for this repo

This PR updates layer 1 (the code-embedded prompts) as requested.

Verification

  • npm run lint — 0 errors, 0 warnings
  • npm test — 192 tests pass (73 app + 119 lib)
  • All three agent templates now inject the enriched prompt
  • Main branch merged, no conflicts

Математические гарантии

Инварианты:

  • ∀ agent ∈ {claude, codex, gemini}: prompt(agent) ⊇ systemPromptBehavior
  • Single source of truth: system-prompt-content.ts → all templates

Доказательства выполнения:

  • All 192 tests pass: verified locally after merge with main
  • Lint clean: 0 errors, 0 warnings
  • Code changes in template files (hardcoded prompts in code), not just docs

🤖 Generated with Claude Code

konard and others added 2 commits March 24, 2026 09:06
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: ProverCoderAI#189
Analyzed all prompt-related issues (ProverCoderAI#96, ProverCoderAI#101, ProverCoderAI#78, ProverCoderAI#41, ProverCoderAI#54, ProverCoderAI#92, ProverCoderAI#90,
ProverCoderAI#109, ProverCoderAI#110, ProverCoderAI#111, ProverCoderAI#122, ProverCoderAI#4, ProverCoderAI#143, ProverCoderAI#108) and synthesized a comprehensive
system prompt that incorporates:

- Reasoning model from AGENTS.md (role simulation, not personal opinions)
- Deep Research process rule (internal, not response format)
- Instrumental behavior requirements (use tools, don't offer guides)
- Mandatory subagent usage for task delegation (ProverCoderAI#101, ProverCoderAI#4)
- Plan mode on clone (ProverCoderAI#54)
- Mandatory response contract addressing trust gap (ProverCoderAI#96):
  status, root cause, what changed, verification, where to check
- Proof of execution requirements in PRs (ProverCoderAI#92):
  screenshots, logs, artifacts in .knowledge/evidence/
- Research loop for uncertainty/failures
- Stricter type safety rules (unknown/as boundaries)
- Monadic composition bans (async/await, Promise chains in prod code)
- Effect-TS resource management (acquireRelease + scoped)
- Boundary data decoding requirement

Both CLAUDE.md and AGENTS.md are now aligned with each other and with
the more comprehensive version that was already in AGENTS.md, plus the
new requirements from the issues listed above.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] Пройдись по всем моим Issues в которых я писал информацию об промте и составь мне системный промт исходя из того что я там просил + того что есть уже сейчас docs(prompt): unify system prompt from all issue requirements Mar 24, 2026
@konard konard marked this pull request as ready for review March 24, 2026 09:21
@konard
Copy link
Copy Markdown
Contributor Author

konard commented Mar 24, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $4.654270
  • Calculated by Anthropic: $2.908727 USD
  • Difference: $-1.745543 (-37.50%)

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Main model: Claude Opus 4.6 (claude-opus-4-6)
  • Additional models:
    • Claude Haiku 4.5 (claude-haiku-4-5-20251001)

📎 Log file uploaded as Gist (1678KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented Mar 24, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@skulidropek
Copy link
Copy Markdown
Member

Ты не понял. Я хотел обновить системный прмот для docker-git контейнерах. ОН зашит в коде

@konard konard marked this pull request as draft March 24, 2026 11:17
@konard
Copy link
Copy Markdown
Contributor Author

konard commented Mar 24, 2026

🤖 AI Work Session Started

Starting automated work session at 2026-03-24T11:17:02.908Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback.

Update the code-embedded system prompts that are injected into
CLAUDE.md, AGENTS.md, and GEMINI.md when docker-git containers start.

Extracts shared behavioral instructions into a new
system-prompt-content.ts module and injects them into all three
agent templates (claude, codex, gemini).

New prompt sections based on issues ProverCoderAI#96, ProverCoderAI#101, ProverCoderAI#78, ProverCoderAI#41, ProverCoderAI#54, ProverCoderAI#92, ProverCoderAI#90:
- Isolated environment awareness
- Instrumental behavior (execute, don't guide)
- Deep Research process rule
- Mandatory subagent delegation with plan mode
- Mandatory response contract (status, root cause, changes, verification)
- Proof of execution requirements in PRs
- Public API usage (no localhost URLs)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title docs(prompt): unify system prompt from all issue requirements feat(core): enrich hardcoded system prompts in container templates Mar 24, 2026
@konard konard marked this pull request as ready for review March 24, 2026 11:54
@konard
Copy link
Copy Markdown
Contributor Author

konard commented Mar 24, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $6.379617
  • Calculated by Anthropic: $4.165636 USD
  • Difference: $-2.213981 (-34.70%)

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Main model: Claude Opus 4.6 (claude-opus-4-6)
  • Additional models:
    • Claude Haiku 4.5 (claude-haiku-4-5-20251001)

📎 Log file uploaded as Gist (1754KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented Mar 24, 2026

🔄 Auto-restart 1/3

Detected uncommitted changes from previous run. Starting new session to review and commit or discard them.

Uncommitted files:

?? ci-logs/

Auto-restart will stop after changes are committed or discarded, or after 2 more iterations. Please wait until working session will end and give your feedback.

konard and others added 2 commits March 24, 2026 12:04
…equirements

Add missing behavioral sections from issues ProverCoderAI#96, ProverCoderAI#41, ProverCoderAI#92, ProverCoderAI#4, ProverCoderAI#54:
- Role/goal definition (mathematician-programmer, ProverCoderAI#41)
- Research loop on failures (ProverCoderAI#41, AGENTS.md)
- Claim safety rule - no "fixed" without proof (ProverCoderAI#96)
- Visibility rule - check why user may not see result (ProverCoderAI#96)
- CI/CD rule - always return failing step + reproduce command (ProverCoderAI#96)
- Rational comments format (CHANGE/WHY/REF, ProverCoderAI#41)
- Micro-agent creation capability (ProverCoderAI#4)
- Detailed proof-of-execution requirements (ProverCoderAI#92)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard
Copy link
Copy Markdown
Contributor Author

konard commented Mar 24, 2026

🔄 Auto-restart 1/3 Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $3.236396
  • Calculated by Anthropic: $1.770646 USD
  • Difference: $-1.465750 (-45.29%)

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Model: Claude Opus 4.6 (claude-opus-4-6)

📎 Log file uploaded as Gist (2978KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented Mar 24, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@skulidropek
Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 340538e5-247d-4f57-a2f8-a00e495e0f4e

📥 Commits

Reviewing files that changed from the base of the PR and between f964400 and 55ea4b5.

📒 Files selected for processing (7)
  • AGENTS.md
  • CLAUDE.md
  • packages/app/tests/docker-git/entrypoint-auth.test.ts
  • packages/lib/src/core/templates-entrypoint/claude-extra-config.ts
  • packages/lib/src/core/templates-entrypoint/codex.ts
  • packages/lib/src/core/templates-entrypoint/gemini.ts
  • packages/lib/src/core/templates-entrypoint/system-prompt-content.ts

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • Documentation

    • Updated agent operating instructions with stricter behavioral guidelines and mandatory response contracts.
    • Enhanced architectural rules and process requirements for better consistency.
    • Added explicit proof of execution documentation standards.
  • Refactor

    • Made system prompt behavior configurable and dynamically injectable across all agent templates.
  • Tests

    • Updated test assertions to verify new behavior blocks in agent prompts.

Walkthrough

This PR extracts shared behavioral instructions into a reusable constant, documents mandatory agent operating guidelines and architectural rules, and injects the behavior into Claude, Codex, and Gemini entrypoint templates via placeholder substitution. Test assertions verify behavior integration.

Changes

System Prompt Behavior and Agent Guidelines

Layer / File(s) Summary
Shared system prompt behavior definition
packages/lib/src/core/templates-entrypoint/system-prompt-content.ts
New systemPromptBehavior constant exports static plain-text instructions covering role/goal, mandatory rules (no browser, verify via builds/tests, real commands only), deep research guidelines, subagent delegation requirements, strict answer contract (Status, Root Cause, What changed, Verification, Where to check), safety/visibility rules, PR proof requirements, and inline code-comment templates.
Agent operating guidelines
AGENTS.md
Response behavior wording refined; mandatory subagent usage added; strict response contract introduced; TypeScript as-casting rule clarified to allow only in one "axiomatic" module; Proof of Execution section added with minimum evidence categories and storage location (.knowledge/evidence/<issue-or-pr>/...); BEFORE MERGE checklist extended to require proofs attachment.
Architectural and coding rules
CLAUDE.md
Reasoning model requirements and Functional Core/Imperative Shell principles clarified; Effect-based composition rules enforced (prohibition on async/await, Promise chains, Promise.all; mandated Effect.try/Effect.tryPromise for interop; Effect.acquireRelease/Effect.scoped for resources); requirement markup templates (QUOTE/REF/SOURCE) added; exhaustive pattern matching with Match required; Proof of Execution section with evidence types (UI/UX, API/Backend, Bugfix, Data/Migration, Performance) introduced; unit test example refactored from async/await to it.effect(...) with pipe composition, Effect.provide, and Effect.asVoid; quality checklists expanded with async/await, Promise chains, try/catch, and console.* prohibitions; proofs attachment required on BEFORE MERGE.
Claude entrypoint template integration
packages/lib/src/core/templates-entrypoint/claude-extra-config.ts
systemPromptBehavior imported; global prompt template now uses __SYSTEM_PROMPT_BEHAVIOR__ placeholder; renderClaudeGlobalPromptSetup performs .replaceAll("__SYSTEM_PROMPT_BEHAVIOR__", systemPromptBehavior).
Codex/AGENTS entrypoint template integration
packages/lib/src/core/templates-entrypoint/codex.ts
systemPromptBehavior imported; __SYSTEM_PROMPT_BEHAVIOR__ placeholder introduced in template; SUBAGENTS_LINE replaced with $BEHAVIOR_BLOCK in both initial and update AGENTS.md templates; renderEntrypointAgentsNotice performs placeholder replacement.
Gemini entrypoint template integration
packages/lib/src/core/templates-entrypoint/gemini.ts
systemPromptBehavior imported; GEMINI.md notice template updated with __SYSTEM_PROMPT_BEHAVIOR__ placeholder replacing hard-coded instruction; renderEntrypointGeminiNotice performs placeholder replacement alongside existing __GEMINI_HOME__ and __TARGET_DIR__ substitutions.
Test verification of behavior injection
packages/app/tests/docker-git/entrypoint-auth.test.ts
Rendered entrypoint assertions updated to check for BEHAVIOR_BLOCK= and Russian prompt block markers (SUBAGENTS (ОБЯЗАТЕЛЬНО):, ОБЯЗАТЕЛЬНЫЙ КОНТРАКТ ОТВЕТА:, DEEP RESEARCH:), replacing prior SUBAGENTS_LINE="..." string and occurrence-count assertions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes


🐰 A prompt so shared, now lives everywhere,
Through Claude and Gemini, floating in air,
With proof and with purpose, each agent now knows
What must be done—onward the docker-git flow goes!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: enriching hardcoded system prompts in container templates with shared behavioral instructions.
Description check ✅ Passed The description provides comprehensive coverage including what changed, new prompt sections mapped to issues, architecture layers, and verification steps. It aligns well with the repository template.
Linked Issues check ✅ Passed The PR fully addresses issue #189 by synthesizing system prompt requirements from multiple prompt-related issues and embedding enriched behavioral instructions into container templates.
Out of Scope Changes check ✅ Passed All changes directly support the main objective of enriching system prompts with behavioral instructions. Template modifications, new shared content module, and test updates are all in scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch issue-189-ba783568b6b3

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants